package com.zerui.manager.app.devicegroup;

import com.zerui.cola.dto.Response;
import com.zerui.cola.dto.SingleResponse;
import com.zerui.manager.app.devicegroup.executer.*;
import com.zerui.manager.web.DeviceGroupService;
import com.zerui.manager.web.cmd.DeviceGroupAddCmd;
import com.zerui.manager.web.cmd.DeviceGroupMoveCmd;
import com.zerui.manager.web.cmd.DeviceGroupUpdateCmd;
import com.zerui.manager.web.vo.DeviceGroupVO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @Author wh
 * @create_time 2023-08-23 11:08
 */
@Service
public class DeviceGroupServiceImpl implements DeviceGroupService {

    @Resource
    private DeviceGroupAddCmdExe deviceGroupAddCmdExe;

    @Resource
    private DeviceGroupUpdateCmdExe deviceGroupUpdateCmdExe;

    @Resource
    private DeviceGroupDelCmdExe deviceGroupDelCmdExe;

    @Resource
    private DeviceGroupQryCmdExe deviceGroupQryCmdExe;

    @Resource
    private DeviceGroupMoveCmdExe deviceGroupMoveCmdExe;

    @Override
    public Response add(DeviceGroupAddCmd deviceGroupAddCmd) {
        return deviceGroupAddCmdExe.execute(deviceGroupAddCmd);
    }

    @Override
    public Response update(DeviceGroupUpdateCmd deviceGroupUpdateCmd) {
        return deviceGroupUpdateCmdExe.execute(deviceGroupUpdateCmd);
    }

    @Override
    public Response deleteById(Long id) {
        return deviceGroupDelCmdExe.execute(id);
    }

    @Override
    public Response move(DeviceGroupMoveCmd deviceGroupMoveCmd) {
        return deviceGroupMoveCmdExe.execute(deviceGroupMoveCmd);
    }

    @Override
    public SingleResponse<DeviceGroupVO> deviceGroupList() {
        return deviceGroupQryCmdExe.execute();
    }
}
